<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>src/globals.js - sceneGraph.js</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
    <script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">

<div id="doc">
    <div id="hd" class="yui3-g header">
        <div class="yui3-u-3-4">
            
                <h1><img src="../../logo/logoCGSG_256x57.png" title="sceneGraph.js"></h1>
            
        </div>
        <div class="yui3-u-1-4 version">
            <em>API Docs for: v2.1.0</em>
        </div>
    </div>
    <div id="bd" class="yui3-g">

        <div class="yui3-u-1-4">
            <div id="docs-sidebar" class="sidebar apidocs">
                <div id="api-list">
    <h2 class="off-left">APIs</h2>
    <div id="api-tabview" class="tabview">
        <ul class="tabs">
            <li><a href="#api-classes">Classes</a></li>
            <li><a href="#api-modules">Modules</a></li>
        </ul>

        <div id="api-tabview-filter">
            <input type="search" id="api-filter" placeholder="Type to filter APIs">
        </div>

        <div id="api-tabview-panel">
            <ul id="api-classes" class="apis classes">
            
                <li><a href="../classes/CGSG.html">CGSG</a></li>
            
                <li><a href="../classes/CGSGAccordion.html">CGSGAccordion</a></li>
            
                <li><a href="../classes/CGSGAnimationManager.html">CGSGAnimationManager</a></li>
            
                <li><a href="../classes/CGSGAnimationMethod.html">CGSGAnimationMethod</a></li>
            
                <li><a href="../classes/CGSGBindEntry.html">CGSGBindEntry</a></li>
            
                <li><a href="../classes/CGSGButtonMode.html">CGSGButtonMode</a></li>
            
                <li><a href="../classes/CGSGCollisionGhostOnDemandTester.html">CGSGCollisionGhostOnDemandTester</a></li>
            
                <li><a href="../classes/CGSGCollisionManager.html">CGSGCollisionManager</a></li>
            
                <li><a href="../classes/CGSGCollisionMethod.html">CGSGCollisionMethod</a></li>
            
                <li><a href="../classes/CGSGCollisionRegionTester.html">CGSGCollisionRegionTester</a></li>
            
                <li><a href="../classes/CGSGCollisionTesterFactory.html">CGSGCollisionTesterFactory</a></li>
            
                <li><a href="../classes/CGSGColor.html">CGSGColor</a></li>
            
                <li><a href="../classes/CGSGCSSManager.html">CGSGCSSManager</a></li>
            
                <li><a href="../classes/CGSGDimension.html">CGSGDimension</a></li>
            
                <li><a href="../classes/CGSGEvent.html">CGSGEvent</a></li>
            
                <li><a href="../classes/CGSGEventManager.html">CGSGEventManager</a></li>
            
                <li><a href="../classes/CGSGHandleBox.html">CGSGHandleBox</a></li>
            
                <li><a href="../classes/CGSGImgManager.html">CGSGImgManager</a></li>
            
                <li><a href="../classes/CGSGInterpolator.html">CGSGInterpolator</a></li>
            
                <li><a href="../classes/CGSGInterpolatorLinear.html">CGSGInterpolatorLinear</a></li>
            
                <li><a href="../classes/CGSGInterpolatorTCB.html">CGSGInterpolatorTCB</a></li>
            
                <li><a href="../classes/CGSGKeyFrame.html">CGSGKeyFrame</a></li>
            
                <li><a href="../classes/CGSGMap.html">CGSGMap</a></li>
            
                <li><a href="../classes/CGSGMask.html">CGSGMask</a></li>
            
                <li><a href="../classes/CGSGMaskCache.html">CGSGMaskCache</a></li>
            
                <li><a href="../classes/CGSGMaskClip.html">CGSGMaskClip</a></li>
            
                <li><a href="../classes/CGSGMath.html">CGSGMath</a></li>
            
                <li><a href="../classes/CGSGNode.html">CGSGNode</a></li>
            
                <li><a href="../classes/CGSGNodeButton.html">CGSGNodeButton</a></li>
            
                <li><a href="../classes/CGSGNodeCircle.html">CGSGNodeCircle</a></li>
            
                <li><a href="../classes/CGSGNodeColorPicker.html">CGSGNodeColorPicker</a></li>
            
                <li><a href="../classes/CGSGNodeCurveTCB.html">CGSGNodeCurveTCB</a></li>
            
                <li><a href="../classes/CGSGNodeDomElement.html">CGSGNodeDomElement</a></li>
            
                <li><a href="../classes/CGSGNodeEllipse.html">CGSGNodeEllipse</a></li>
            
                <li><a href="../classes/CGSGNodeImage.html">CGSGNodeImage</a></li>
            
                <li><a href="../classes/CGSGNodeLine.html">CGSGNodeLine</a></li>
            
                <li><a href="../classes/CGSGNodeSlider.html">CGSGNodeSlider</a></li>
            
                <li><a href="../classes/CGSGNodeSliderHandle.html">CGSGNodeSliderHandle</a></li>
            
                <li><a href="../classes/CGSGNodeSprite.html">CGSGNodeSprite</a></li>
            
                <li><a href="../classes/CGSGNodeSquare.html">CGSGNodeSquare</a></li>
            
                <li><a href="../classes/CGSGNodeTabMenu.html">CGSGNodeTabMenu</a></li>
            
                <li><a href="../classes/CGSGNodeText.html">CGSGNodeText</a></li>
            
                <li><a href="../classes/CGSGNodeWebview.html">CGSGNodeWebview</a></li>
            
                <li><a href="../classes/CGSGParticle.html">CGSGParticle</a></li>
            
                <li><a href="../classes/CGSGParticleEmitter.html">CGSGParticleEmitter</a></li>
            
                <li><a href="../classes/CGSGParticleSystem.html">CGSGParticleSystem</a></li>
            
                <li><a href="../classes/CGSGPickNodeMethod.html">CGSGPickNodeMethod</a></li>
            
                <li><a href="../classes/CGSGPosition.html">CGSGPosition</a></li>
            
                <li><a href="../classes/CGSGRegion.html">CGSGRegion</a></li>
            
                <li><a href="../classes/CGSGRotation.html">CGSGRotation</a></li>
            
                <li><a href="../classes/CGSGScale.html">CGSGScale</a></li>
            
                <li><a href="../classes/CGSGSceneGraph.html">CGSGSceneGraph</a></li>
            
                <li><a href="../classes/CGSGSection.html">CGSGSection</a></li>
            
                <li><a href="../classes/CGSGTimeline.html">CGSGTimeline</a></li>
            
                <li><a href="../classes/CGSGTraverser.html">CGSGTraverser</a></li>
            
                <li><a href="../classes/CGSGVector2D.html">CGSGVector2D</a></li>
            
                <li><a href="../classes/CGSGView.html">CGSGView</a></li>
            
                <li><a href="../classes/CGSGWEBVIEWMODE.html">CGSGWEBVIEWMODE</a></li>
            
                <li><a href="../classes/CGSGWrapMode.html">CGSGWrapMode</a></li>
            
                <li><a href="../classes/GLOBAL_CONSTANTS.html">GLOBAL_CONSTANTS</a></li>
            
                <li><a href="../classes/GLOBAL_METHODS.html">GLOBAL_METHODS</a></li>
            
                <li><a href="../classes/GLOBAL_PROPERTIES.html">GLOBAL_PROPERTIES</a></li>
            
                <li><a href="../classes/UTIL_ARRAY.html">UTIL_ARRAY</a></li>
            
                <li><a href="../classes/WUICCGSGNodeImageFactory.html">WUICCGSGNodeImageFactory</a></li>
            
            </ul>

            <ul id="api-modules" class="apis modules">
            
                <li><a href="../modules/Animation.html">Animation</a></li>
            
                <li><a href="../modules/Collision.html">Collision</a></li>
            
                <li><a href="../modules/Math.html">Math</a></li>
            
                <li><a href="../modules/Node.html">Node</a></li>
            
                <li><a href="../modules/ParticleSystem.html">ParticleSystem</a></li>
            
                <li><a href="../modules/Scene.html">Scene</a></li>
            
                <li><a href="../modules/Util.html">Util</a></li>
            
            </ul>
        </div>
    </div>
</div>

            </div>
        </div>
        <div class="yui3-u-3-4">
                <div id="api-options">
        Show:
        <label for="api-show-inherited">
            <input type="checkbox" id="api-show-inherited" checked>
            Inherited
        </label>

        <label for="api-show-protected">
            <input type="checkbox" id="api-show-protected">
            Protected
        </label>

        <label for="api-show-private">
            <input type="checkbox" id="api-show-private">
            Private
        </label>
        <label for="api-show-deprecated">
            <input type="checkbox" id="api-show-deprecated">
            Deprecated
        </label>

    </div>


            <div class="apidocs">
                <div id="docs-main">
                    <div class="content">
                        <h1 class="file-heading">File: src/globals.js</h1>

<div class="file">
    <pre class="code prettyprint linenums">
/*
 * Copyright (c) 2014 Gwennael Buchet
 *
 * License/Terms of Use
 *
 * Permission is hereby granted, free of charge and for the term of intellectual property rights on the Software, to any
 * person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to use, copy, modify
 * and propagate free of charge, anywhere in the world, all or part of the Software subject to the following mandatory conditions:
 *
 *   •    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 *
 *  Any failure to comply with the above shall automatically terminate the license and be construed as a breach of these
 *  Terms of Use causing significant harm to Gwennael Buchet.
 *
 *  THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 *  WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
 *  OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 *  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 *  Except as contained in this notice, the name of Gwennael Buchet shall not be used in advertising or otherwise to promote
 *  the use or other dealings in this Software without prior written authorization from Gwennael Buchet.
 *
 *  These Terms of Use are subject to French law.
 */

/**
 * List the methods to check the pick on a node
 * @class CGSGPickNodeMethod
 * @type {Object}
 * @author Gwennael Buchet (gwennael.buchet@gmail.com)
 */
var CGSGPickNodeMethod = {
    /**
     * @property GHOST
     */
    GHOST : &quot;ghost&quot;,
    /**
     * @property REGION
     */
    REGION: &quot;region&quot;
};

/**
 * Global properties of the framework
 *
 * @class GLOBAL_PROPERTIES
 * @module Util
 * @static
 * @author Gwennael Buchet (gwennael.buchet@gmail.com)
 */

/**
 * List of the parameters of different browsers
 * @property cgsgExplorerParams
 * @type {Object}
 */
var cgsgExplorerParams = {
    IE10     : {name: &quot;IE 10 or above&quot;, browserName: &quot;&quot;, fullVersion: &quot;&quot;, textDecalYTop: 4.3, textDecalYBottom: 1.26, textDecalYMiddle: 1.87, textDecalYAlpha: 0.983, webworker: false},
    IE9      : {name: &quot;IE 9&quot;, browserName: &quot;&quot;, fullVersion: &quot;&quot;, textDecalYTop: 4.3, textDecalYBottom: 1.26, textDecalYMiddle: 1.87, textDecalYAlpha: 0.983, webworker: false},
    SAFARI   : {name: &quot;Safari&quot;, browserName: &quot;&quot;, fullVersion: &quot;&quot;, textDecalYTop: 4.0, textDecalYBottom: 1.27, textDecalYMiddle: 1.77, textDecalYAlpha: 0.983, webworker: false},
    CHROME   : {name: &quot;Chrome&quot;, browserName: &quot;&quot;, fullVersion: &quot;&quot;, textDecalYTop: 3.3, textDecalYBottom: 1.268, textDecalYMiddle: 2.09, textDecalYAlpha: 0.983, webworker: false},
    OPERA    : {name: &quot;Opera&quot;, browserName: &quot;&quot;, fullVersion: &quot;&quot;, textDecalYTop: 3.5, textDecalYBottom: 1.28, textDecalYMiddle: 2.0, textDecalYAlpha: 0.995, webworker: false},
    FIREFOX  : {name: &quot;Firefox&quot;, browserName: &quot;&quot;, fullVersion: &quot;&quot;, textDecalYTop: 10, textDecalYBottom: 1.23, textDecalYMiddle: 1.77, textDecalYAlpha: 0.983, webworker: false},
    KONQUEROR: {name: &quot;Konqueror&quot;, browserName: &quot;&quot;, fullVersion: &quot;&quot;, textDecalYTop: 10, textDecalYBottom: 1.23, textDecalYMiddle: 1.77, textDecalYAlpha: 0.983, webworker: false},
    UNKNOWN  : {name: &quot;Unknown&quot;, browserName: &quot;&quot;, fullVersion: &quot;&quot;, textDecalYTop: 10, textDecalYBottom: 1.23, textDecalYMiddle: 1.77, textDecalYAlpha: 0.983, webworker: false}
};

/**
 * Current version of the browser. The framework check the browser at the start and fill this property.
 * @property cgsgCurrentExplorer
 * @readonly
 * @default cgsgExplorerParams.UNKNOWN
 * @type {Object}
 */
var cgsgCurrentExplorer = cgsgExplorerParams.UNKNOWN;

/**
 * Global properties for the current scene
 *
 * @class CGSG
 * @module Util
 * @static
 * @author Gwennael Buchet (gwennael.buchet@gmail.com)
 */
var CGSG = {

    /**
     * Current version of the framework
     * @property version
     * @static
     * @type {String}
     */
    version: &quot;2.0.0-SNAPSHOT&quot;,

    /**
     * The scene graph itself
     * @property sceneGraph
     * @default null
     * @type {CGSGSceneGraph}
     */
    sceneGraph: null,

    /**
     * Current display ratio
     * @property displayRatio
     * @static
     * @type {CGSGScale}
     */
    displayRatio: CGSG_DEFAULT_DISPLAYRATIO,

    /**
     * Default threshold to detect the handle boxes on a resizable node
     * @property resizeHandleThreshold
     * @static
     * @type {Number}
     */
    resizeHandleThreshold: CGSG_DEFAULT_SELECTED_RESIZEHANDLE_THRESHOLD,

    /**
     * The current frame in hte global timeline
     * @property currentFrame
     * @readonly
     * @type {Number}
     */
    currentFrame: 0,

    /**
     * The canvas container for this scene
     * @property canvas
     * @readonly
     * @type {HTMLElement}
     */
    canvas: null,

    /**
     * The main rendering 2D context for this scene
     * @property context
     * @type {CanvasRenderingContext2D}
     */
    context: null,

    /**
     * The global ghost context for fake rendering
     * @property ghostContext
     * @readonly
     * @type {CanvasRenderingContext2D}
     */
    ghostContext: null,

    /**
     * the color used for the ghost mode rendering
     * @property ghostColor
     * @type {String}
     * @public
     */
    ghostColor: &quot;#FF0000&quot;,

    /**
     * List of the current selected nodes in the scenegraph.
     * @property selectedNodes
     * @type {Array}
     */
    selectedNodes: [],

    /**
     * List of the timelines for the animations.
     * A timeline consists of a list of animation keys for 1 attribute of 1 node
     * @property listTimelines
     * @type {Array}
     * @private
     */
    listTimelines: [],

    /**
     * Number of frames to average the FPS.
     * Reduce this number to get more accurate FPS
     * @property framerateDelay
     * @default CGSG_DEFAULT_FRAMERATE_DELAY
     * @type {Number}
     */
    framerateDelay: CGSG_DEFAULT_FRAMERATE_DELAY,

    /**
     * Maximum number of frames per second. Set it if you want your application to slow down.
     * @property maxFramerate
     * @default CGSG_DEFAULT_MAX_FRAMERATE
     * @type {Number}
     * @example
     *     //limit the fps of the application to 30
     *     CGSG.maxFramerate : 30,
     */
    maxFramerate: CGSG_DEFAULT_MAX_FRAMERATE,

    /**
     * Current framerate of the application
     * @property fps
     * @type {Number}
     */
    fps: 0,

    /**
     * If set to true, the bounding boxes for selected nodes will be rendered on top of the scene
     * If set to false, the bounding boxes for selected nodes will be rendered on top of the node
     * @property isBoundingBoxOnTop
     * @default true
     * @type {Boolean}
     */
    isBoundingBoxOnTop: true,

    /**
     * Instance of CollisionTesterFactory
     * @property collisionTestFactory
     * @type {CGSGCollisionTesterFactory}
     */
    collisionManager: new CGSGCollisionManager(),

    cssManager: new CGSGCSSManager(),

    /**
     * Object that defines the performance keys.
     * Change values to adapt your project.
     *
     * CGSG.performanceKeys._collisionMethod :
     *                Key to specify collision detection mod
     *                Use setCollisionMethod to modify value,
     *                Default : CGSGCollisionMethod.REGION
     *
     * CGSG.performanceKeys.collisionTester :
     *                Collision tester depending on _collisionMethod,
     *                Default : CGSGCollisionRegionTester
     *
     * @property performanceKeys
     * @type {Object}
     */
    performanceKeys: {
        _collisionMethod: CGSGCollisionMethod.REGION,

        _cgsgCollisionTesterFactory: new CGSGCollisionTesterFactory(),

        collisionTester: new CGSGCollisionRegionTester(),

        /**
         * Redefines the collision method
         * @method setCollisionMethod
         * @param method
         */
        setCollisionMethod: function (method) {
            this._collisionMethod = method,
                this.collisionTester = this._cgsgCollisionTesterFactory.getCollisionTester(this._collisionMethod);
        }
    },

    /**
     * Animation manager
     * @property animationManager
     * @type {CGSGAnimationManager}
     */
    animationManager: new CGSGAnimationManager(),

    /**
     * Event manager to use to bind events to objects.
     *
     * @property eventManager
     * @type {CGSGEventManager}
     */
    eventManager: new CGSGEventManager(),

    /**
     * Default threshold apply to all new nodes when detecting selection.
     *
     * @property globalDetectSelectionThreshold
     * @type {Number}
     */
    globalDetectSelectionThreshold: 0
};

/**
 * All kinds of events defined by the CGSceneGraph framework.
 *
 * @property cgsgEventTypes
 * @type {Object}
 */
var cgsgEventTypes = {

    // Nodes rendering
    ON_BEFORE_RENDER            : &quot;onBeforeRender&quot;,
    ON_AFTER_RENDER             : &quot;onAfterRender&quot;,
    //ON_BEGIN_RENDER: &quot;onBeginRender&quot;,
    //ON_FINISH_RENDER: &quot;onFinishRender&quot;,
    BEFORE_RENDER_END           : &quot;onBeforeRenderEnd&quot;,
    AFTER_RENDER_START          : &quot;onAfterRenderStart&quot;,

    // Node SRT
    ON_TRANSLATE                : &quot;onTranslate&quot;,
    ON_ROTATE                   : &quot;onRotate&quot;,
    ON_SCALE                    : &quot;onScale&quot;,
    ON_RESIZE                   : &quot;onResize&quot;,
    ON_RESIZE_END               : &quot;onResizeEnd&quot;,

    // Node mouse event
    ON_MOUSE_UP                 : &quot;onMouseUp&quot;,
    ON_MOUSE_OVER               : &quot;onMouseOver&quot;,
    ON_MOUSE_OUT                : &quot;onMouseOut&quot;,
    ON_MOUSE_ENTER              : &quot;onMouseEnter&quot;,
    ON_CLICK                    : &quot;onClick&quot;,
    ON_CLICK_START              : &quot;onClickStart&quot;,
    ON_DBL_CLICK                : &quot;onDblClick&quot;,
    ON_DRAG                     : &quot;onDrag&quot;,
    ON_DRAG_END                 : &quot;onDragEnd&quot;,

    // Node state event
    ON_CHILD_ADD                : &quot;onChildAdd&quot;,
    ON_CHILD_REMOVED            : &quot;onChildRemove&quot;,
    ON_SELECT                   : &quot;onSelect&quot;,
    ON_DESELECT                 : &quot;onDeselect&quot;,
    ON_FREE                     : &quot;onFreeEvent&quot;,
    ON_LOAD_END                 : &quot;onLoadEnd&quot;,
    ON_LOAD_ERROR               : &quot;onLoadError&quot;,
    ON_LOAD_ABORT               : &quot;onLoadAbort&quot;,

    // Scene
    ON_RENDER_START             : &quot;onRenderStart&quot;,
    ON_RENDER_END               : &quot;onRenderEnd&quot;,
    ON_SCENE_DBL_CLICK_START    : &quot;onSceneDblClickStart&quot;,
    ON_SCENE_DBL_CLICK_END      : &quot;onSceneDblClickEnd&quot;,
    ON_SCENE_CLICK_START        : &quot;onSceneClickStart&quot;,
    ON_SCENE_CLICK_END          : &quot;onSceneClickEnd&quot;,
    ON_SCENE_AVERAGE_FPS_CHANGED: &quot;onSceneAverageFpsChanged&quot;,

    // Timeline
    ON_ANIMATE                  : &quot;onAnimate&quot;,
    ON_ANIMATION_START          : &quot;onAnimationStart&quot;,
    ON_ANIMATION_END            : &quot;onAnimationEnd&quot;,

    // Particle
    ON_UPDATE_PARTICLE_END      : &quot;onUpdateParticleEnd&quot;,
    ON_INIT_PARTICLE            : &quot;onInitParticle&quot;,

    // Tab
    ON_TAB_CHANGED              : &quot;onTabChanged&quot;
};


    </pre>
</div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
